# Author: lvin

# 删除列表 clear()
names = ["Mike", "Mary", "Jan", "Jack"]
names.clear()
print(names)

# 合并列表 extend 是有顺序的， （）里面的 list 排在后面
names_1 = ["Mike", "Mary", "Jan", "Jack"]
names_2 = ["CC", "LL",]

names_1.extend(names_2)
print(names_1)

names_2.extend(names_1)
print(names_2)

# 复制列表 copy()  赋值 不等于 真正意义的复制
names_2复制 = names_2
print(names_2)
print(names_2复制)
names_2.append("YT")
print("name_2:",names_2)
print("name_2复制:",names_2复制)

# 引入 copy()
names_2源数据备份 = names_2.copy()
print(names_2)
print(names_2源数据备份)
names_2.append("YT")
print("name_2:",names_2)
print("name_2复制:",names_2源数据备份)

# 用 切片[:] 等价于  copy()  方法
names_2源数据备份 = names_2[:]
print(names_2)
print(names_2源数据备份)
names_2.append("YT")
print("name_2:",names_2)
print("name_2复制:",names_2源数据备份)


# 统计数量 count() 查看元素出现的次数
stu_id = [61,73,63,84,35,96,100,96,98,63,75]
print(stu_id.count(96))

# 排序 sart()
stu_id.sart()   # 默认从低到高排序
stu_id.sart(reverse=True)  # reverse=True 从高到低排序
print(stu_id)

